﻿using SQLite;
using SQLiteNetExtensions.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dt261.Model
{

   

    [Table("EroChart")]

    class EroChart
    {
        private int id;
        int time; 
         int value;

        string resultid;

        public int Time { get => time; set => time = value; }
        public int Value { get => value; set => this.value = value; }
        public string Resultid { get => resultid; set => resultid = value; }

        [PrimaryKey, AutoIncrement]
        public int Id { get => id; set => id = value; }
    }

    [Table("EroFrequency")]
    class EroFrequency
    {
        private int id;
        int noise;
    string range;
    int signal;
    int sort;
        string resultid;
        public int Noise { get => noise; set => noise = value; }//噪声
        public string Range { get => range; set => range = value; }
        public int Signal { get => signal; set => signal = value; }//信号
        //信噪比：Signal - Noise
        public int Sort { get => sort; set => sort = value; }

        public string Resultid { get => resultid; set => resultid = value; }

        [PrimaryKey, AutoIncrement]
        public int Id { get => id; set => id = value; }
    }


    [Table("EroResult")]
    class EroResult
    {
        private int id;
        private string uid;

        string entityid;
        [PrimaryKey, AutoIncrement]
        public int Id { get => id; set => id = value; }
        public string Uid { get => uid; set => uid = value; }


        private int ear; // 左右耳
        private string intensity; // 刺激强度
        private double ratio;// 相关系数
        private int energy;// 总反应能量


        public int Ear { get => ear; set => ear = value; }
        public string Intensity { get => intensity; set => intensity = value; }
        public double Ratio { get => ratio; set => ratio = value; }
        public int Energy { get => energy; set => energy = value; }
        //val frequency: List<EroFrequency>,
        //val chart: List<EroChart>

        [OneToMany]
        public List<EroFrequency> frequency { get; set; }


        [OneToMany]
        public List<EroChart> chart { get; set; }
        public string Entityid { get => entityid; set => entityid = value; }

        public EroResult()
        {
            chart = new List<EroChart>();

            frequency = new List<EroFrequency>();
        }
    }

    [Table("EroEntity")]
    class EroEntity
    {
        private int id;
        private string uid;

        string name;
        string memberId;// 患者 ID
        DateTime createTime; // 测试时间
        int type;  // TEOAE = 1,DPOAE = 2

        private string doctorOption;//筛查意见

        [PrimaryKey, AutoIncrement]
        public int Id { get => id; set => id = value; }
        public string Uid { get => uid; set => uid = value; }
        public string MemberId { get => memberId; set => memberId = value; }
        public DateTime CreateTime { get => createTime; set => createTime = value; }
        public int Type { get => type; set => type = value; }
        public string Name { get => name; set => name = value; }



        [OneToMany]
        public List<EroResult> results { get; set; }
        public string DoctorOption { get => doctorOption; set => doctorOption = value; }
      

        public EroEntity()
        {
            results = new List<EroResult>();
        }
    }
}
